<?php
     require_once('MysqlConnect.php');
     $sql="select * from articlelist";
     $query=mysql_query($sql);
     if($query&&mysql_num_rows($query)){
          while($row=mysql_fetch_assoc($query)){
               $data[]=$row;
          }
     }
     else{
          $data=array();
     }     
?>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
     <link rel="stylesheet" href="articleCss.css">
</head>
<body>
	<div id="header" style="background-image:url('BG1.png');width:900px;"> <h1 style="text-align:center;">文章发布管理系统</h1></div>
	<div id="menu" style="background-image:url('BG2.jpg');float:left;width:100px;" >
			<p style="text-align:center;"><a href="Article_add_display.php">发布文章</a></p>
			<p style="text-align:center;"><a href="Article_manage.php">管理文章</a></p>
			<p style="text-align:center;"><a href="MainPage.php">退出登陆</a></p>
	</div>

	<div id="content" style="background-image:url('BG3.jpg');height:800px;width:800px;float:left;">
     <h2 style="text-align:center;">管理文章</h2>
     <br>

     <table width="500" border="1" cellpadding="8" cellspacing="1" align="center" >
     <tr>
          <td align="center">标题</td>
          <td align="center">作者</td>
          <td align="center">操作1</td>
          <td align="center">操作2</td>
          <td align="center">操作3</td>
     </tr>

     <?php
               if(!empty($data)){

                    foreach ($data as $value ) {
                     
     ?>

               <tr>
                    <th>&nbsp;<?php echo $value['title'];?></th>
                    <th>&nbsp;<?php echo $value['author'];?></th>
                    
                    <th>
                         <form action="Article_delete.php" method="post">
                              <input type="hidden" name="id" value="<?php echo $value['id']?>">
                              <input type="submit" value="删除" >
                         </form>
                    </th>

                    <th>
                         <form action="Article_change_display.php" method="post">
                              <input type="hidden" name="id" value="<?php echo $value['id']?>">
                              <input type="submit" value="修改" >
                         </form>
                    </th>

                    <th>
                         <form action="Article_show.php" method="post">
                              <input type="hidden" name="id" value="<?php echo $value['id']?>">
                              <input type="submit" value="查看" >
                         </form>
                    </th>
                    
               </tr>
 
     <?php
               }


          }
     ?>    



     </table>
           
    </div>

</body>
</html>